<script setup>
  // #ifdef H5
  const onSubimt = () => {
    console.log('表单登录')
  }
  // #endif

  // #ifdef MP-WEIXIN
  const wxLogin = async () => {
    const res = await uni.login()
    console.log('小程序', res.code)
  }
  // #endif
</script>
<template>
  <view class="container">
    <!-- #ifdef H5 -->
    <input type="text" placeholder="请输入用户名" />
    <input type="text" password placeholder="请输入密码" />
    <button @click="onSubimt">账户登录</button>
    <!-- #endif -->
    <!-- #ifdef MP-WEIXIN -->
    <button @click="wxLogin">小程序一键授权</button>
    <!-- #endif -->
  </view>
</template>

<style>
  .container {
    /* 没加条件编译的代码 */
    height: 100vh;

    /* #ifdef H5 */
    background-color: pink;
    /* #endif */

    /* #ifdef MP-WEIXIN */
    background-color: skyblue;
    /* #endif */
  }
</style>
